<HTML><HEAD><TITLE>exists(+File)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Operating System</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>exists(+File)</H1>
Succeeds if the file File (with absolute or relative pathname) exists.
File can be a directory.


<DL>
<DT><EM>File</EM></DT>
<DD>Atom or string.
</DD>
</DL>
<H2>Description</H2>
   Used to see if the file File exists.  File can be a directory.
   exists(File) is equivalent to get_file_info(File, mode, _).

<P>

<H3>Modes and Determinism</H3><UL>
<LI>exists(+) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if the file File (with absolute or relative pathname) does not exist
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>File is not instantiated.
<DT><EM>(5) type error </EM>
<DD>File is neither an atom nor a string.
</DL>
<H2>Examples</H2>
<PRE>
Success:
   [eclipse]: sh('ls myfile').
   myfile
   [eclipse]: exists(myfile).
   yes.

   [eclipse]: sh('ls /home/user/workdir').
   myfile
   [eclipse]: exists('/home/user/workdir').
   yes.

Fail:
   [eclipse]: sh('ls nofile').
   nofile not found
   [eclipse]: exists(nofile).
   no.

Error:
   exists(File).                          (Error 4).
   exists([file]).                        (Error 5).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/opsys/existing_file-4.html">existing_file / 4</A>, <A HREF="../../kernel/opsys/get_file_info-3.html">get_file_info / 3</A>, <A HREF="../../kernel/opsys/sh-1.html">sh / 1</A>, <A HREF="../../kernel/opsys/system-1.html">system / 1</A>, <A HREF="../../kernel/opsys/delete-1.html">delete / 1</A>, <A HREF="../../kernel/opsys/mkdir-1.html">mkdir / 1</A>
</BODY></HTML>
